package com.ruoyi.controller;

import com.ruoyi.dto.ResponseDTO;
import com.ruoyi.povo.CouponsVo;
import com.ruoyi.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
public class CouponController {
    @Autowired
    private CouponService couponService;
    @RequestMapping("/getAllCoupons")
    public ResponseDTO getAllCoupons() {
        return couponService.getAllCoupons();
    }
    @RequestMapping("/addCoupon")
    public ResponseDTO addCoupon(@RequestBody CouponsVo couponsVo) {
        System.out.println(couponsVo);

        return couponService.addCoupon(couponsVo);
    }
    @RequestMapping("/editCoupon")
    public ResponseDTO editCoupon(@RequestBody CouponsVo couponsVo) {
        System.out.println(couponsVo);

        return couponService.editCoupon(couponsVo);
    }
    @RequestMapping("/changeCoupon")
    public ResponseDTO changeCoupon(@RequestParam String id,@RequestParam String status) {


        return couponService.changeCoupon(id,status);
    }
}
